//
//  RenHouseDetaBottomCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/19.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "RenHouseDetaBottomCell.h"

@interface RenHouseDetaBottomCell ()

@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end

@implementation RenHouseDetaBottomCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.contentLabel.font = MYFONT(15);
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    

    
    // Initialization code
}


- (void)setModel:(HouseDetailModel *)model{
    _model = model;
    
    if (_model.house_details.length > 0) {
        self.contentLabel.attributedText = [self attributedString:_model.house_details withFont:MYFONT(15)];

    } else {
        self.contentLabel.attributedText = [self attributedString:@"暂无详情" withFont:MYFONT(15)];

    }
    
    

}


- (NSAttributedString *)attributedString:(NSString *)str withFont:(UIFont *)font{
    
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:str];
    
    [attr addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, str.length)];
    [attr addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, str.length)];
    [attr addAttribute:NSKernAttributeName value:@(1.0f) range:NSMakeRange(0, str.length)];
    
    NSMutableParagraphStyle *para = [[NSMutableParagraphStyle alloc]init];
    
    para.lineSpacing = 1;
    
    para.firstLineHeadIndent = 20;
    
    [attr addAttribute:NSParagraphStyleAttributeName value:para range:NSMakeRange(0, str.length)];
    
    
    return attr;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
